<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>知乎图片过滤器设置</title>
  <style>
    body {
      width: 420px;
      height: 580px;
      margin: 0;
      padding: 0;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
      background: #f8f9fa;
    }
    
    /* 标签页样式 */
    .tabs {
      display: flex;
      background: white;
      border-bottom: 1px solid #e8e8e8;
    }
    
    .tab {
      flex: 1;
      padding: 12px 16px;
      text-align: center;
      cursor: pointer;
      background: #f8f9fa;
      border: none;
      border-bottom: 3px solid transparent;
      transition: all 0.3s ease;
      font-size: 14px;
      font-weight: 500;
    }
    
    .tab.active {
      background: white;
      border-bottom-color: #1890ff;
      color: #1890ff;
    }
    
    .tab:hover:not(.active) {
      background: #f0f0f0;
    }
    
    /* 标签内容 */
    .tab-content {
      display: none;
      padding: 15px;
      height: 520px;
      overflow-y: auto;
    }
    
    .tab-content.active {
      display: block;
    }
    
    /* 设置页面样式 */
    .settings-container {
      display: flex;
      flex-direction: column;
      gap: 15px;
    }
    
    .switch {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px;
      background: white;
      border-radius: 8px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .toggle {
      position: relative;
      display: inline-block;
      width: 50px;
      height: 24px;
    }
    
    .toggle input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    
    .slider {
      position: absolute;
      cursor: pointer;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: #ccc;
      transition: .4s;
      border-radius: 24px;
    }
    
    .slider:before {
      position: absolute;
      content: "";
      height: 16px;
      width: 16px;
      left: 4px;
      bottom: 4px;
      background-color: white;
      transition: .4s;
      border-radius: 50%;
    }
    
    input:checked + .slider {
      background-color: #1890ff;
    }
    
    input:checked + .slider:before {
      transform: translateX(26px);
    }
    
    .settings {
      background: white;
      border-radius: 8px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      padding: 15px;
    }
    
    .input-group {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    
    input[type="number"] {
      padding: 8px 12px;
      border: 1px solid #d9d9d9;
      border-radius: 6px;
      font-size: 14px;
    }
    
    .status {
      background: white;
      border-radius: 8px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      padding: 15px;
      text-align: center;
      color: #666;
      font-size: 14px;
    }
    
    /* 图片页面样式 */
    .images-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15px;
      padding: 10px;
      background: white;
      border-radius: 8px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .images-count {
      font-size: 14px;
      color: #666;
    }
    
    .header-controls {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    
    .auto-refresh-switch {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: #666;
      cursor: pointer;
    }
    
    .auto-refresh-switch input[type="checkbox"] {
      width: 14px;
      height: 14px;
      accent-color: #1890ff;
    }
    
    .refresh-btn {
      background: #1890ff;
      color: white;
      border: none;
      border-radius: 6px;
      padding: 6px 12px;
      cursor: pointer;
      font-size: 12px;
      transition: background 0.3s ease;
    }
    
    .refresh-btn:hover {
      background: #40a9ff;
    }
    
    .images-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
    }
    
    .image-item {
      background: white;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      cursor: pointer;
      transition: transform 0.2s ease;
    }
    
    .image-item:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .image-item img {
      width: 100%;
      height: 120px;
      object-fit: cover;
      display: block;
    }
    
    .no-images {
      text-align: center;
      color: #999;
      padding: 40px 20px;
      background: white;
      border-radius: 8px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .loading {
      text-align: center;
      color: #1890ff;
      padding: 20px;
    }
  </style>
</head>
<body>
  <!-- 标签页导航 -->
  <div class="tabs">
    <button class="tab active" data-tab="settings">⚙️ 设置</button>
    <button class="tab" data-tab="images">🖼️ 图片列表</button>
  </div>

  <!-- 设置标签页 -->
  <div class="tab-content active" id="settings-tab">
    <div class="settings-container">
      <div class="switch">
        <span>启用过滤</span>
        <label class="toggle">
          <input type="checkbox" id="enableFilter">
          <span class="slider"></span>
        </label>
      </div>

      <div class="settings">
        <div class="input-group">
          <label for="minImages">最少图片数量</label>
          <input type="number" id="minImages" min="1" value="1">
        </div>
      </div>

      <div class="status" id="status">已过滤 0 条回答</div>
    </div>
  </div>

  <!-- 图片列表标签页 -->
  <div class="tab-content" id="images-tab">
    <div class="images-header">
      <div class="images-count" id="images-count">正在加载...</div>
      <div class="header-controls">
        <label class="auto-refresh-switch">
          <input type="checkbox" id="auto-refresh" checked>
          <span class="switch-text">自动刷新</span>
        </label>
        <button class="refresh-btn" id="refresh-images">刷新</button>
      </div>
    </div>
    
    <div class="images-container">
      <div class="loading" id="images-loading">正在收集图片...</div>
      <div class="images-grid" id="images-grid" style="display: none;"></div>
      <div class="no-images" id="no-images" style="display: none;">
        <p>当前页面没有找到图片</p>
        <p style="font-size: 12px; color: #ccc; margin-top: 10px;">
          请确保在知乎问题页面使用，<br>或尝试降低最少图片数量设置
        </p>
      </div>
    </div>
  </div>

  <script src="popup.js"></script>
</body>
</html>